package com.blkbox.dp.observer.impl;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import com.blkbox.dp.observer.itf.IMaster;

public class TestNormalMaster {
    private static IMaster iMaster;
    private static NormalReader readerA;
    private static NormalReader readerB;
    private static NormalReader readerC;
    private static NormalReader readerD;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        iMaster = new NormalMaster();
        readerA = new NormalReader("readerA", true);
        readerB = new NormalReader("readerB", false);
        readerC = new NormalReader("readerC", true);
        readerD = new NormalReader("readerD", true);
        iMaster.register(readerA);
        iMaster.register(readerB);
        iMaster.register(readerC);
        iMaster.register(readerD);
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
    }

    @Test
    public void testMessgeCreated() {
        iMaster.provideMessage("Message");
        iMaster.provideMessage("Long Message");
        iMaster.deRegister(readerC);
        iMaster.provideMessage("Long Long Message");
    }

}
